﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SpringStudio.Common;
using SpringStudio.DAL;
using Sdepci.InfoCode.BLL.CodeIndex;

namespace Sdepci.InfoCode.Web.CodeIndex
{
    public partial class DictSelector : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                this.BindData();
            }
        }

        private void BindData()
        {
            if (this.Request.QueryString["CateGuid"] != null && this.Request.QueryString["CateGuid"].Trim().Length > 0)
            {
                this.lblCateName.Text = new Cate(this.Request.QueryString["CateGuid"].Trim()).CateName;
                this.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script language=\"javascript\">document.getElementById(\"TreeXmlData\").value = '" + new DictManager().GetDictXmlDoc(this.Request.QueryString["CateGuid"].Trim()).OuterXml + "';</script>");
            }
            if (this.Request.QueryString["length"] != null && this.Request.QueryString["length"].Trim().Length > 0)
            {
                this.length.Value = this.Request.QueryString["length"].Trim();
                this.supplement.Value = this.Request.QueryString["supplement"].Trim();
                this.position.Value = this.Request.QueryString["position"].Trim();
            }
            if (this.Request.QueryString["level"] != null && this.Request.QueryString["level"].Trim().Length > 0)
            {
                this.level.Value = this.Request.QueryString["level"].Trim();
            }
            if (this.Request.QueryString["multiselect"] != null && this.Request.QueryString["multiselect"].Trim().Length > 0)
            {
                this.multiselect.Value = this.Request.QueryString["multiselect"].Trim();
            }
            if (this.Request.QueryString["separator"] != null && this.Request.QueryString["separator"].Trim().Length > 0)
            {
                this.separator.Value = this.Request.QueryString["separator"].Trim();
            }
        }
    }
}
